/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package parseiro;

import com.thoughtworks.qdox.JavaDocBuilder;
import com.thoughtworks.qdox.model.JavaClass;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Filipe
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
        JavaDocBuilder jdb = new JavaDocBuilder();
        List<File> pastas = new ArrayList<File>();
        pastas.add(new File("sources"));

        while (!pastas.isEmpty()) {
            File actual = pastas.remove(0);
            if (actual.isDirectory()) {
                System.out.println("A expandir:" + actual);
                File[] listFiles = actual.listFiles();
                for (File file : listFiles) {
                    pastas.add(file);
                }
            } else {
                try {
                    jdb.addSource(actual);
                } catch (Exception e) {
                    System.out.println("Nao acolhe:\t" + actual);
                }
                System.out.println("adding: " + actual);
            }
        }

        JavaClass[] classes = jdb.getClasses();

        for (JavaClass javaClass : classes) {

            System.out.println("Classe: " + javaClass.getName());

//            System.out.println("\n\n-\tComent: " + javaClass.getComment());
//
//            DocletTag[] tags = javaClass.getTags();
//            for (DocletTag docletTag : tags) {
//                System.out.println("\n\n-\tTag: " + docletTag.getName() + " > " + docletTag.getValue());
//            }



//            JavaMethod[] methods = javaClass.getMethods();
//
//
//            for (JavaMethod javaMethod : methods) {
//                System.out.println("-\tMetodo: " + javaMethod.getName());
//                System.out.println("-\t-\tComent: " + javaMethod.getComment());
//
//
//
//
//            }
        }



    }
}
